/**
 * @Author:Geln Yang
 * @Created:2008-7-27
 * $ Revision: 1.0 $
 * $ Author: Geln Yang $
 * $ Date: 2008-7-27 $
 */
package org.geln.web.listener;

import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

import org.geln.web.Constants;
import org.geln.web.container.Application;
import org.geln.web.context.ISessionContext;
import org.geln.web.webwork.interceptor.SessionContextInterceptor;

/**
 * @Author:Geln Yang
 * @Created:2008-7-27
 */
public class CloseSessionListener implements HttpSessionListener {
	public void sessionCreated(HttpSessionEvent event) {
	}

	public void sessionDestroyed(HttpSessionEvent event) {
		String userId = (String) event.getSession().getAttribute(Constants.USER_LOGIN);
		ISessionContext context = (ISessionContext) Application.getComponent(SessionContextInterceptor.SessionContext);
		if (userId != null) {
			context.clearContext(userId);
		}
	}
}
